{% extends 'homepage.html' %}

{% block content %}
<script type="text/javascript" src="{{ url_for('emf.static', filename='elliptic_modular_form_util-functions.js') }}"></script>
<script type="text/javascript" src="{{ url_for('emf.static', filename='elliptic_modular_form_scripts.js') }}"></script>
{% if error is defined %}
   {{ error | safe }}
{% else %}
<h1> {{ name | safe }} </h1>
<div id="qexp">
<h2> {{ KNOWL('mf.elliptic.q-expansion',title='q-expansion')}}</h2>
{# { q_exp | safe }#}
<br>
{# Get the q-expansion #}
<span id="qexp">
\( 
{% if c[0] and not c[0][0] == '0' %}
  {% set nstart=0 %}
{% else %}
  {% set nstart=1 %}
{% endif %} 
{% for n in range(nstart,maxc) %}
  {% if not c[n][0] == '1' %}
    {{ c[n] }} 
  {% endif %}
  {% if n==1 %} 
   q
  {% else %}
   q^{  {{n}} } 
  {% endif %}
    
  {% if n < maxc-1 and not c[n+1][0]=='-' %}
  + 
 {% endif %}
{% endfor %}
 + O(q^{ {{maxc}} })
\) 
</span>
</div>
{{ polynomial_st | safe }}
<br>
{% if is_rational==0 %}
<h3>Embeddings</h3>
It is possible to embed the Fourier coefficients in the \(q\)-expansion above
in the field of complex numbers. The values are shown in the table below.

<table class="ntdata">
<thead>
  <tr><th>\(n\)</th>
    {% for n in range(1,embeddings_len) %}
    <th>{{n}}</th>
    {% endfor %}
  </tr>
</thead>
<tbody>
  {% for h in range(degree) %}
  <tr>
    <th style="border-right:solid black 1px">
      \( v_{{h}}(a(n)) \)
    </th>
    {% for n in range(1,embeddings_len) %}
    <td style="white-space:nowrap;">
      {{ embeddings[n][h] }}
    </td>
    {% endfor %}
  </tr>
  {% endfor %}
</tbody>
</table>
{% endif %}
<h2> Detailed data</h2>
<div>
  The first few {{KNOWL('mf.elliptic.satake_parameters',title='Satake parameters')}} \(\alpha_p\) and angles \(\theta_p = \textrm{Arg}(\alpha_p) \) are
</div>
<br>
{% if satake is defined %}
<table class="ntdata">
  <thead>
    <tr>
      <th>\( p \)</th>
      {% for ps in satake.ps %}
      <th> {{ps}}</th>
      {% endfor %}
    </tr>
  </thead>
  <tdata>
    {% for h in range(0,degree) %}
    {% if degree >1 %}
    <tr  style="border-top: solid black 1px">
      {% else %}
    <tr>
      {% endif %}  
      <th style="border-right: solid black 1px">
        \(\alpha_{p}\)
      </th>
      {% for ps in satake.ps %}
      <td>\( {{satake.alphas_latex[h][ps]}} \)</td>
      {% endfor %}
    </tr>
    <tr>
      <th style="border-right: solid black 1px">
        \(\theta_{p}\)
      </th>
      {% for ps in satake.ps %}
      <td> \( {{satake.thetas_latex[h][ps]}} \)</td>
      {% endfor %}
    </tr>
    {% endfor %}
  </tdata>
</table>
{% endif %}

{% if CM_values is defined %}
<h2>Special Values</h2>
<div>
  Values at some  {{ KNOWL('mf.elliptic.cm-points',title='CM points')}}
</div>
<p>
  <table class="ntdata" style="width:50%">
    <thead>
      <tr>
        <th width="20px" style="border-right:1px solid black">Point&nbsp;\&nbsp;Embedding</th>
        {% for h in CM_values.embeddings  %}
        <th width="{{ CM_values.max_width }}">{{ h |safe }}</th>
        {% endfor %}
      </tr>
    </thead>
    <tbody>
      {% for tau in CM_values.tau %}
      <tr>
        <th width="10px" style="border-right: 1px solid black">
          {{ CM_values.tau_latex[tau] |  safe }}
        </th>
        {% for h in CM_values.cm_vals[tau]  %}
        {% set vals =CM_values.cm_vals_latex[tau] %}
        <td width="50px">{{ vals[h] }}</td>
        {% endfor %}
        {% endfor %}            
      </tr>
    </tbody>
  </table>
</p>
{% endif %}

{% if explicit_formulas is defined %}
<h2> {{KNOWL('mf.elliptic.explicit_formula',title='')}}Explicit Formulas</h2>
	
{{ explicit_formulas }}

{% endif %}

{% if  true %}

<h2>Further Properties</h2>
<div>
  {% if is_cm is defined or is_minimal is defined %}
  <ul>
  {% if is_cm is defined %}
  <li>
    This newform is 
    {% if not is_cm[0] %}
    not
    {% endif %}
    a {{KNOWL('mf.elliptic.cm_form',title='CM form')}}.
    {% endif %}
    </li>
  {% if is_minimal is defined %}
  <li>
    It is 
    {% if not is_minimal %}
    not
    {% endif %}
    {{KNOWL('mf.elliptic.minimal',title='minimal')}}.
  </li>
  {% endif %}
  {% if atkinlehner is defined and atkinlehner%}
  <li>
    The function has {{KNOWL('mf.elliptic.atkinlehner',title='Atkin-Lehner')}} eigenvalues given by 
    <table class="ntdata">
      <thead>
        <tr>
          <th> \( Q \) </th>
        <th> Cusp </th>
          <th>Eigenvalue
        </tr>
      </thead>
      <tbody>
        {% for Q,c,ev in atkinlehner %}
        <tr>
          <th> {{Q}} </th>
          <th> {{ c }} </th>
          <td> {{ev}}</td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </li>
  {% endif %}
  </ul>
</div>
  {% endif %}
<h2>Download Fourier coefficients</h2>
<form name="get_coefficients" method="post"  action="{{url_for('.get_downloads',level=level,weight=weight,character=character,label=label)}}">
  <input type="hidden" name="download" value="coefficients"/>
  Get / compute  <input type="text" size="10" name="number" value="10"/> 
  coefficients in the following format:
  <ul>
    <li> 
      <label><input type=radio name="format" checked value="q_expansion_one_line" onclick="return selectCFormat(event)"> q-expansion (on one line)</label>
    </li>
    <li> 
      <label><input type=radio name="format" checked value="q_expansion_table" onclick="return selectCFormat(event)"> q-expansion (table)</label>
    </li>
    <li>
      <label><input type=radio name="format" value="embeddings" onclick="return selectCFormat(event)"> Complex embeddings </label>
      with <input type="text" size="10" name="prec" value="15"> digits precision.     
    </li>
  </ul>
{#  <input type="button" name="Submit" value="Get coefficients"> #}
 <input type="submit" name="Submit" value="Get coefficients">
</form>

<h2>Download as {{KNOWL('sage',title='Sage')}} Object</h2>
<form name="download_object_form" method="post"  action="{{url_for('.render_elliptic_modular_forms')}}">
  <input type="hidden" name="download" value="object">
  <input type="hidden" name="level" value="{{level }}">
  <input type="hidden" name="character" value="{{character }}">
  <input type="hidden" name="weight" value="{{weight }}">
  <input type="hidden" name="label" value="{{label }}">
  <input type="submit" name="Submit" value="Download" Onclick="document.download.submit()">
</form>
<div class="formexample"> 
<form name="download_file" method="post"  action="{{url_for('.render_elliptic_modular_forms')}}">
  Note: In order to use this data file you need to download and import
  <input type="hidden" name="download" value="file">
  <input type="hidden" name="download_file" value="web_modforms.py">
  <a href="javascript:void(0);" OnClick="document.download_file.submit()">web_modforms.py</a>
 </form>
</div>
{% endif %}
{% endif %}
</div>

{% endblock %}
